package com.cdks.wuxiu.common.exception;

import com.cdks.wuxiu.common.component.constant.ApiCodeEnum;


/**
 * 自定义 API接口异常
 */
public class ApiException extends RuntimeException {
    private final Integer retCode;
    private final String retHint;
    private Object retData;


    public ApiException(ApiCodeEnum code) {
        super(code.getHint());

        this.retCode = code.getCode();
        this.retHint = code.getHint();
    }

    public ApiException(ApiCodeEnum code, Object errData) {
        super(code.getHint());

        this.retCode = code.getCode();
        this.retHint = code.getHint();
        this.retData = errData;
    }

    public ApiException(Integer errCode, String errHint) {
        super(errHint);

        this.retCode = errCode;
        this.retHint = errHint;
    }

    public ApiException(Integer errCode, String errHint, Object errData) {
        super(errHint);

        this.retCode = errCode;
        this.retHint = errHint;
        this.retData = errData;
    }

    public Integer getRetCode() {
        return retCode;
    }

    public String getRetHint() {
        return retHint;
    }

    public Object getRetData() {
        return retData;
    }
}
